]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
ScreenShield: fix positioning of background with multimonitor
authorGiovanni Campagna <gcampagna@src.gnome.org>
Thu, 21 Feb 2013 22:32:25 +0000 (23:32 +0100)
committerGiovanni Campagna <gcampagna@src.gnome.org>
Mon, 25 Feb 2013 13:46:40 +0000 (14:46 +0100)
Previously, we would create one StBin per monitor, but each was positioned
at 0,0 and sized as the screen, so they would overlap and draw the box shadows
on top of the other backgrounds.
Instead, we need to size appropriately the bin, and then we need to position
the actual MetaBacgroundActor at 0,0, so add a flag to BackgroundManager
for this.
Also, get rid of MetaBackgroundGroup, they do nothing because the screenshield
is not a descendant of the MetaWindowGroup and because the widget in between
blocks the propagation of the visible region. At the same time, use a
widget, not a bin, because StBin requires you to set .child, not call add_child().

https://bugzilla.gnome.org/show_bug.cgi?id=694394

js/ui/background.js
js/ui/screenShield.js

index ef4dad3e35bd1e00c848d70a6063e2ee5f619f03..3268059052a0de676683de8c02d51c5f3ab997c2 100644 (file)
@@ -635,12 +635,14 @@ const BackgroundManager = new Lang.Class({
         params = Params.parse(params, { container: null,
                                         layoutManager: Main.layoutManager,
                                         monitorIndex: null,
-                                        effects: Meta.BackgroundEffects.NONE });
+                                        effects: Meta.BackgroundEffects.NONE,
+                                        controlPosition: true });
 
         this._container = params.container;
         this._layoutManager = params.layoutManager;
         this._effects = params.effects;
         this._monitorIndex = params.monitorIndex;
+        this._controlPosition = params.controlPosition;
 
         this.background = this._createBackground();
         this._newBackground = null;
@@ -700,9 +702,12 @@ const BackgroundManager = new Lang.Class({
         this._container.add_child(background.actor);
 
         let monitor = this._layoutManager.monitors[this._monitorIndex];
-        background.actor.set_position(monitor.x, monitor.y);
+
         background.actor.set_size(monitor.width, monitor.height);
-        background.actor.lower_bottom();
+        if (this._controlPosition) {
+            background.actor.set_position(monitor.x, monitor.y);
+            background.actor.lower_bottom();
+        }
 
         let signalId = background.connect('changed', Lang.bind(this, function() {
             background.disconnect(signalId);
index 5ab593f4f7a9df0174644fe43d75db261893c4d7..7b3953b7c6dc8720fc811aaffa9016375ddec7b4 100644 (file)
@@ -447,7 +447,7 @@ const ScreenShield = new Lang.Class({
 
         this._lockScreenGroup.add_actor(this._lockScreenContents);
 
-        this._backgroundGroup = new Meta.BackgroundGroup();
+        this._backgroundGroup = new Clutter.Actor();
 
         this._lockScreenGroup.add_actor(this._backgroundGroup);
         this._backgroundGroup.lower_bottom();
@@ -538,21 +538,22 @@ const ScreenShield = new Lang.Class({
     },
 
     _createBackground: function(monitorIndex) {
-        let bin = new St.Bin({ style_class: 'screen-shield-background' });
-
-        let group = new Meta.BackgroundGroup();
-        bin.child = group;
-
-        let bgManager = new Background.BackgroundManager({ container: group,
+        let monitor = Main.layoutManager.monitors[monitorIndex];
+        let widget = new St.Widget({ style_class: 'screen-shield-background',
+                                     x: monitor.x,
+                                     y: monitor.y,
+                                     width: monitor.width,
+                                     height: monitor.height });
+
+        let bgManager = new Background.BackgroundManager({ container: widget,
                                                            monitorIndex: monitorIndex,
-                                                           effects: Meta.BackgroundEffects.BLUR | Meta.BackgroundEffects.DESATURATE });
-
+                                                           effects: Meta.BackgroundEffects.BLUR | Meta.BackgroundEffects.DESATURATE,
+                                                           controlPosition: false });
         bgManager.background.saturation = 0.6;
 
         this._bgManagers.push(bgManager);
 
-        this._backgroundGroup.add_child(bin);
-        bin.lower_bottom();
+        this._backgroundGroup.add_child(widget);
     },
 
     _updateBackgrounds: function() {